import random

from rest_framework.permissions import BasePermission


class UserPermission(BasePermission):
    message = {"status": False, "msg": "权限不足"}

    def has_permission(self, request, view):
        if request.user.role == 3:
            return True
        return False


class ManagerPermission(BasePermission):
    message = {"status": False, "msg": "权限不足"}

    def has_permission(self, request, view):
        if request.user.role == 2:
            return True
        return False


class BossPermission(BasePermission):
    message = {"status": False, "msg": "权限不足"}

    def has_permission(self, request, view):
        if request.user.role == 1:
            return True
        return False
